﻿Module Module1

    Sub Main()
        Dim a As Integer, i As Integer, b As Boolean
        Console.WriteLine("This program can help you find prime numbers. -- Written by Yuxuan in VB.NET")
start:
        Console.WriteLine()
        Console.Write("Enter the upper limit...")
        a = Console.ReadLine()
        Console.WriteLine()
        Console.WriteLine("Here is the prime numbers not greater than {0}.", a)
        For ii = 2 To a
            b = True
            For i = 2 To Math.Sqrt(ii)
                If ii Mod i = 0 Then
                    b = False
                End If
            Next
            If b = True Then
                Console.WriteLine("{0}", ii)
            End If
        Next
        Console.WriteLine()
        Console.Write("Press any key to start over...")
        Console.ReadKey()
        Console.WriteLine()
        GoTo start
    End Sub
End Module
